﻿<?xml version="1.0" encoding="utf-8" ?>
<!--namespace必须用否者就报错（读取配置文件报：未将对象引用设置到对象的实例）-->
<sqlMap namespace="" xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  
  <statements>

    <insert id="ProductCategory.Insert" parameterClass="hashtable">
      INSERT INTO [Cubic_ProductCategory]
      (
      [CategoryCode]
      ,[CategoryName]
      ,[ParentId]
      ,[Sequence]
      ,[CategoryImg]
      ,[CategoryUrl]
      ,[ContentCount]
      ,[CategoryDesc]
      ,[SeoTitle]
      ,[SeoH1]
      ,[SeoDes]
      ,[CreateMan]
      ,[CreateTime]
      )
      VALUES
      (
      #CategoryCode#
      ,#CategoryName#
      ,#ParentId#
      ,#Sequence#
      ,#CategoryImg#
      ,#CategoryUrl#
      ,#ContentCount#
      ,#CategoryDesc#
      ,#SeoTitle#
      ,#SeoH1#
      ,#SeoDes#
      ,#CreateMan#
      ,#CreateTime#
      )
    </insert>

    <update id="ProductCategory.Update" parameterClass="hashtable" resultClass="int">
      UPDATE [Cubic_ProductCategory]
      SET
      [CategoryCode] =#CategoryCode#
      ,[CategoryName] =#CategoryName#
      ,[ParentId] =#ParentId#
      ,[Sequence] =#Sequence#
      ,[CategoryImg] =#CategoryImg#
      ,[CategoryUrl] =#CategoryUrl#
      ,[ContentCount] =#ContentCount#
      ,[CategoryDesc] =#CategoryDesc#
      ,[SeoTitle] =#SeoTitle#
      ,[SeoH1] =#SeoH1#
      ,[SeoDes] =#SeoDes#
      ,[CreateMan] =#CreateMan#
      ,[CreateTime] =#CreateTime#

      WHERE  [Id] =#Id#
    </update>

    <select id="ProductCategory.Get" parameterClass="string" resultClass="Kaiser.Modules.Cubic.DomainModel.Product.ProductCategory">
      select
      [Id]
      ,[CategoryCode]
      ,[CategoryName]
      ,[ParentId]
      ,(select CategoryName from Cubic_ProductCategory as a where a.Id=Cubic_ProductCategory.ParentId) ParentName
      ,[Sequence]
      ,[CategoryImg]
      ,[CategoryUrl]
      ,[ContentCount]
      ,[CategoryDesc]
      ,[SeoTitle]
      ,[SeoH1]
      ,[SeoDes]
      ,[CreateMan]
      ,[CreateTime]
      from Cubic_ProductCategory
      where [Id]='$Id$'
    </select>
    <select id="ProductCategory.GetByCode" parameterClass="string" resultClass="Kaiser.Modules.Cubic.DomainModel.Product.ProductCategory">
      select
      [Id]
      ,[CategoryCode]
      ,[CategoryName]
      ,[ParentId]
      ,(select CategoryName from Cubic_ProductCategory as a where a.Id=Cubic_ProductCategory.ParentId) ParentName
      ,[Sequence]
      ,[CategoryImg]
      ,[CategoryUrl]
      ,[ContentCount]
      ,[CategoryDesc]
      ,[SeoTitle]
      ,[SeoH1]
      ,[SeoDes]
      ,[CreateMan]
      ,[CreateTime]
      from Cubic_ProductCategory
      where [CategoryCode]=#value#
    </select>
    <select id="ProductCategory.GetAll" parameterClass="string" resultClass="Kaiser.Modules.Cubic.DomainModel.Product.ProductCategory">
      select
      [Id]
      ,[CategoryCode]
      ,[CategoryName]
      ,[ParentId]
      ,[Sequence]
      ,[CategoryImg]
      ,[CategoryUrl]
      ,[ContentCount]
      ,[CategoryDesc]
      ,[SeoTitle]
      ,[SeoH1]
      ,[SeoDes]
      ,[CreateMan]
      ,[CreateTime]
      from Cubic_ProductCategory

    </select>

    <delete id="ProductCategory.DeleteList" parameterClass="string" resultClass="int">
      delete from [Cubic_ProductCategory] where [Id] in
      <iterate   property="ids" open="(" close=")"  conjunction=",">
        #ids[]#
      </iterate>
    </delete>

    <delete id="ProductCategory.Delete" parameterClass="string" resultClass="int">
      delete from [Cubic_ProductCategory] where [Id] =#Id#
    </delete>

  </statements>
</sqlMap>

